import { RouteRecordRaw } from 'vue-router';
import { Layout } from '@/router/constant';
import { UserOutlined } from '@vicons/antd';
import { renderIcon } from '@/utils/index';

const routeName = 'player';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/player',
    name: routeName,
    redirect: '/player/playerManage.ts',
    component: Layout,
    meta: {
      title: '玩家列表',
      icon: renderIcon(UserOutlined),
      permissions: [
        'player_playerManage',
        'player_playerRole',
        'player_rechargeRecord',
        'player_reflectRecord',
        'player_reflectFlow',
      ],
      sort: 5,
    },
    children: [
      {
        path: 'playerManage',
        name: `${routeName}_playerManage`,

        meta: {
          title: '玩家管理',
          permissions: ['player_playerManage'],
          keepAlive: false,
        },
        component: () => import('@/views/player/playerManage/playerManage.vue'),
      },
      {
        path: 'playerDetailInfo/:id',
        name: `${routeName}_playerDetailInfo`,
        meta: {
          title: '玩家详情',
          hidden: true,
          activeMenu: `${routeName}_playerDetailInfo`,
        },
        component: () => import('@/views/player/playerManage/playerDetailInfo.vue'),
      },
      {
        path: 'playerRole',
        name: `${routeName}_playerRole`,
        meta: {
          title: '玩家角色',
          permissions: ['player_playerRole'],
          keepAlive: false,
        },
        component: () => import('@/views/player/playerRole/playerRole.vue'),
      },
      {
        path: 'rechargeRecord',
        name: `${routeName}_rechargeRecord`,
        meta: {
          title: '充值记录',
          permissions: ['player_rechargeRecord'],
          keepAlive: false,
        },
        component: () => import('@/views/player/rechargeRecord/rechargeRecord.vue'),
      },
      {
        path: 'rechargeFlow',
        name: `${routeName}_rechargeFlow`,
        meta: {
          title: '充值流水',
          permissions: ['player_rechargeFlow'],
          keepAlive: false,
        },
        component: () => import('@/views/player/rechargeFlow/rechargeFlow.vue'),
      },
      {
        path: 'reflectRecord',
        name: `${routeName}_reflectRecord`,
        meta: {
          title: '提现记录',
          permissions: ['player_reflectRecord'],
          keepAlive: false,
        },
        component: () => import('@/views/player/reflectRecord/reflectRecord.vue'),
      },
      {
        path: 'reflectFlow',
        name: `${routeName}_reflectFlow`,
        meta: {
          title: '提现记录',
          permissions: ['player_reflectFlow'],
          keepAlive: false,
        },
        component: () => import('@/views/player/reflectFlow/reflectFlow.vue'),
      },
      {
        path: 'chanPlayer',
        name: `${routeName}_chanPlayer`,
        meta: {
            title: '渠道玩家',
            permissions: ['player_chanPlayer'],
            keepAlive: false,
        },
        component: () => import('@/views/player/chanPlayer/index.vue'),
    }
    ],
  },
];

export default routes;
